package com.example.mybatis.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Objects;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Employee implements Serializable {

    private Long id;
    private String lastName;
    private Integer age;
    private String email;
    private String gender;

    private Department dept;

    public Employee(String lastName, Integer age, String email, String gender) {
        this.lastName = lastName;
        this.age = age;
        this.email = email;
        this.gender = gender;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return Objects.equals(id, employee.id) && Objects.equals(lastName, employee.lastName) && Objects.equals(age, employee.age) && Objects.equals(email, employee.email) && Objects.equals(gender, employee.gender) && Objects.equals(dept, employee.dept);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, lastName, age, email, gender, dept);
    }
}
